#pragma once


#include <iostream>
#include <malloc.h>
#include <pthread.h>
#include <unistd.h>
#include <functional>
#include <queue>
#include "../sqltask/sqltask.h"
using std::cout;using std::endl;


class threadpool
{
public:

    threadpool(){};
    ~threadpool(){};

    std::queue<sqltask> taskqueue;

    pthread_mutex_t mutextaskqueue;
    pthread_mutex_t mutexthreadpool;
    pthread_mutex_t mutexbusyerNum;  

    pthread_cond_t sigNotfull;
    pthread_cond_t sigNotempty;


    int workerNum;
    int busyerNum;

    bool shutdown;

    pthread_t* tids;


    void init();

    void deinit();
    void addtask(sqltask sqltask);



};
